/**
 * 数组扁平化
 * @param tree
 * @returns
 */
const flatten = (tree, key) => {
    return tree.reduce((item, next) => {
        return item.concat(Array.isArray(next[`${key}`]) ? flatten(next[`${key}`], key) : next);
    }, []);
};

export { flatten as default };
